#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<math.h>
int digit(int x, int i)
{
    int sum = 0;
    for (int k = 0; k < i; k++)
    {
        sum += x % 10 * pow(10, k);
        x /= 10;
    }
    return sum;
}


int main() {
    int x = 0, i = 0;
    scanf("%d %d", &x, &i);
    printf("%d", digit(x, i));
    return 0;
}